package com.classes.constants.logic;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;

public interface Constants {

    //常量池
    public static List<Constants> contants_pool = new ArrayList<>();


    public void parse(ByteBuffer buffer);

    public String getContent();


    default public byte read(ByteBuffer buffer) {
        return buffer.get();
    }

    /**
     * 常量池长度
     *
     * @param buffer
     * @return
     */
    public static short constants_size(ByteBuffer buffer) {
        return (short) (buffer.getShort() - 1);
    }
}
